//
//  MoodSecondViewController.m
//  Today
//
//  Created by dllo on 15/5/25.
//  Copyright (c) 2015年 fanfan. All rights reserved.
//

#import "MoodSecondViewController.h"
#import "MoodViewController.h"

@interface MoodSecondViewController ()

@end

@implementation MoodSecondViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    moodTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    moodTextView.backgroundColor = [UIColor colorWithRed:1.000 green:0.972 blue:0.735 alpha:1.000];
    [moodTextView becomeFirstResponder];
    moodTextView.text = _cellContent;
    [self.view addSubview:moodTextView];
    [moodTextView release];
    
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"iconfont-zhinenghuaxuanpinicon2"] style:UIBarButtonItemStylePlain target:self action:@selector(selectorfinish)];
    
    // Do any additional setup after loading the view.
}

- (void)selectorfinish
{
    myAlertView = [[SIAlertView alloc] initWithTitle:nil andMessage:@"改动完成?"];
    [myAlertView addButtonWithTitle:@"完成" type:SIAlertViewButtonTypeDefault handler:^(SIAlertView *alertView) {
        [MoodDataBaseTool updateMoodDB:moodTextView.text :_cellContent];
        
        [self.navigationController popViewControllerAnimated: YES];
        
        
    }];
    [myAlertView addButtonWithTitle:@"取消" type:SIAlertViewButtonTypeCancel handler:^(SIAlertView *alertView) {
        
    }];
    [myAlertView show];
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
